package com.gopay.common.domain.cbrmb;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.domain.BaseEntity;

/**
 * 跨境人民币报盘辅助表 YBY
 */
@Entity
@Table(name = "CB_RMB_TRAN_ASSIST_DTL")
public class CbRmbTranAssistDtl extends BaseEntity {

    private static final long serialVersionUID = 1L;

    private Integer cbRmbDtlSq;
    /**
     * 国付宝订单号
     */
    private String gopayOrderId;
    /**
     * 报盘状态
     */
    private String state;
    /**
     * 报盘完成时间
     */
    private Date bpFinishTime;
    /**
     * 回盘完成时间
     */
    private Date hpFinishTime;
    /**
     * 邮电费
     */
    private BigDecimal orderPostFeeAmt;
    /**
     * 收货人
     */
    private String receiver;
    /**
     * 收货人证件号码
     */
    private String receiverCertNo;
    /**
     * 客户类型 1-私人 2-企业
     */
    private String custType;

    /**
     * 交易类型 01720-进口 01723--留学汇款 01724-跨境汇款 01726--境外提现
     */
    private String tranType;

    /**
     * '审核状态 0-待审核 1-审核通过 2-审核拒绝';
     */
    private String auditStatus;

    /**
     * 最后更新时间
     */
    private Date lastUpdateTime;

    /**
     * 版本
     */
    private int version;

    /**
     * 汇款附言、交易附言
     */
    private String tradeDesc;

    /**
     * 交易编码
     */
    private String tradeCode;

    /**
     * 是否保税货物项下收汇标志，Y/N
     */
    private String isbonded;

    /**
     * 收款人ID
     */
    private Long receiverId;

    /**
     * 是否还原申报 Y/N Y：付款信息为实际付款人； N:付款信息为支付机构 默认为N
     */
    private String restoreNeeded = "N";
    
    /** 
     * 订单支付完成时间
     */
    private Date payFinishTime;

    /**
     * 报盘银行代码
     */
    private String toBankCode;
    
    /**
     * 收款人是否是企业名称 Y-是 N-否
     */
    private String isCorpName;

    /**
     * 自动对账次数
     */
    private int checkNum = 0;

    public CbRmbTranAssistDtl() {
        super();
    }

    @Id
    @SequenceGenerator(name = "CB_RMB_TRAN_ASSIST_DTL_SQ", sequenceName = "CB_RMB_TRAN_ASSIST_DTL_SQ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CB_RMB_TRAN_ASSIST_DTL_SQ")
    @Column(name = "CB_RMB_DTL_SQ", unique = true, nullable = false)
    public Integer getCbRmbDtlSq() {
        return cbRmbDtlSq;
    }

    public void setCbRmbDtlSq(Integer cbRmbDtlSq) {
        this.cbRmbDtlSq = cbRmbDtlSq;
    }
    
    @Column(name = "GOPAY_ORDER_ID")
    public String getGopayOrderId() {
        return gopayOrderId;
    }

    public void setGopayOrderId(String gopayOrderId) {
        this.gopayOrderId = gopayOrderId;
    }

    @Column(name = "STATE")
    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    @Column(name = "BP_FINISH_TIME")
    public Date getBpFinishTime() {
        return bpFinishTime;
    }

    public void setBpFinishTime(Date bpFinishTime) {
        this.bpFinishTime = bpFinishTime;
    }

    @Column(name = "HP_FINISH_TIME")
    public Date getHpFinishTime() {
        return hpFinishTime;
    }

    public void setHpFinishTime(Date hpFinishTime) {
        this.hpFinishTime = hpFinishTime;
    }

    @Column(name = "ORDER_POST_FEE_AMT")
    public BigDecimal getOrderPostFeeAmt() {
        return orderPostFeeAmt;
    }

    public void setOrderPostFeeAmt(BigDecimal orderPostFeeAmt) {
        this.orderPostFeeAmt = orderPostFeeAmt;
    }

    @Column(name = "RECEIVER")
    public String getReceiver() {
        this.receiver = SensitiveInfoUtils.autoReencrypt(this.receiver);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.receiver);
    }

    public void setReceiver(String receiver) {
        this.receiver = SensitiveInfoUtils.smartEncryptWithCheck(receiver);
    }

    @Column(name = "RECEIVER_CERT_NO")
    public String getReceiverCertNo() {
        this.receiverCertNo = SensitiveInfoUtils.autoReencrypt(this.receiverCertNo);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.receiverCertNo);
    }

    public void setReceiverCertNo(String receiverCertNo) {
        this.receiverCertNo = SensitiveInfoUtils.smartEncryptWithCheck(receiverCertNo);
    }

    @Column(name = "CUST_TYPE")
    public String getCustType() {
        return custType;
    }

    public void setCustType(String custType) {
        this.custType = custType;
    }

    @Column(name = "TRAN_TYPE")
    public String getTranType() {
        return tranType;
    }

    public void setTranType(String tranType) {
        this.tranType = tranType;
    }

    @Column(name = "AUDIT_STATUS")
    public String getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(String auditStatus) {
        this.auditStatus = auditStatus;
    }

    @Column(name = "LAST_UPDATE_TIME")
    public Date getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Date lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    @Version
    @Column(name = "VERSION", nullable = false, precision = 22, scale = 0)
    public int getVersion() {
        return this.version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    @Column(name = "TRADE_DESC")
    public String getTradeDesc() {
        return tradeDesc;
    }

    public void setTradeDesc(String tradeDesc) {
        this.tradeDesc = tradeDesc;
    }

    @Column(name = "TRADE_CODE")
    public String getTradeCode() {
        return tradeCode;
    }

    public void setTradeCode(String tradeCode) {
        this.tradeCode = tradeCode;
    }

    @Column(name = "ISBONDED")
    public String getIsbonded() {
        return isbonded;
    }

    public void setIsbonded(String isbonded) {
        this.isbonded = isbonded;
    }

    @Column(name = "RECEIVER_ID", precision = 22, scale = 0)
    public Long getReceiverId() {
        return this.receiverId;
    }

    public void setReceiverId(Long receiverId) {
        this.receiverId = receiverId;
    }

    @Column(name = "RESTORE_NEEDED")
    public String getRestoreNeeded() {
        return restoreNeeded;
    }

    public void setRestoreNeeded(String restoreNeeded) {
        this.restoreNeeded = restoreNeeded;
    }

    @Column(name = "PAY_FINISH_TIME")
    public Date getPayFinishTime() {
        return payFinishTime;
    }

    public void setPayFinishTime(Date payFinishTime) {
        this.payFinishTime = payFinishTime;
    }

    @Column(name = "TO_BANK_CODE")
    public String getToBankCode() {
        return toBankCode;
    }

    public void setToBankCode(String toBankCode) {
        this.toBankCode = toBankCode;
    }

    @Column(name = "IS_CORP_NAME")
    public String getIsCorpName() {
        return isCorpName;
    }

    public void setIsCorpName(String isCorpName) {
        this.isCorpName = isCorpName;
    }

    @Column(name = "CHECK_NUM")
    public int getCheckNum() {
        return checkNum;
    }

    public void setCheckNum(int checkNum) {
        this.checkNum = checkNum;
    }
}
